package com.eshopkeeper.service.sys;

import com.baomidou.mybatisplus.plugins.Page;
import com.eshopkeeper.core.base.BaseService;
import com.eshopkeeper.model.sys.SysMenu;
import com.eshopkeeper.model.sys.ext.SysMenuBean;
import com.eshopkeeper.provider.sys.ISysMenuProvider;
import com.weibo.api.motan.config.springsupport.annotation.MotanReferer;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author chenshufeng
 * @Description: 菜单
 * @date 2017年3月7日
 */
@Service
public class SysMenuService extends BaseService<ISysMenuProvider, SysMenu> {

    @MotanReferer(basicReferer = "clientBasicConfig")
    public void setProvider(ISysMenuProvider provider) {
        this.provider = provider;
    }

    public List<Map<String, String>> getPermissions() {
        return provider.getPermissions();
    }
    
    //添加菜单
    @Override
    public void add(SysMenu sysMenu) {
    	provider.insertSysMenu(sysMenu);
    }

	public List<Map<String, Object>> queryParentList() {
		return provider.queryParentList();
	}

	public Page<SysMenuBean> queryMenuList(Map<String, Object> params) {
		return provider.queryMenuList(params);
	}

    /**
     * 更新菜单，自动调整序号
     * @param sysMenuBean
     * @return
     */
    public int updateMenuById(SysMenuBean sysMenuBean) {
        return provider.updateMenuById(sysMenuBean);
    }

}
